package com.cn.sl.server.api.system.department.model.entity

import com.cn.sl.server.api.system.user.model.entity.AdminUserEntity
import com.cn.sl.server.common.model.SoftDeleteEditableEntity
import io.hypersistence.utils.hibernate.type.json.JsonType
import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.Table
import org.hibernate.annotations.Type

@Table(name = "department")
@Entity
class DepartmentEntity : SoftDeleteEditableEntity<AdminUserEntity>() {
    var parentId: Long? = null

    /**
     * 名称
     */
    var name: String = ""

    /**
     * 说明
     */
    var memo: String? = ""

    /**
     * 排序
     */
    var sort: Int? = null

    /**
     * 层级
     */
    @Type(JsonType::class)
    @Column(name = "name_path", columnDefinition = "json")
    var namePath: List<String> = arrayListOf()
}